<template>
	<div>
		<van-search v-model="value" placeholder="请输入搜索关键词" show-action @search="Onserch" @cancel="back">
			<template #aciton>
				<span style="font-weight: 700;">取消</span>
			</template>
		</van-search>
		
		<!-- 历史记录 -->
		<div v-if="this.historyList.length != 0">
			<div style="margin-left: 10px;margin-top: 10px;font-size: 15px;color: inherit;">历史记录</div>
			<van-tag type="warning" style="margin-left: 10px;margin-top: 10px;"
			 v-for="(item,index) in historyList" :key="index"
			>{{item}}</van-tag>
		</div>
		
		<!-- 猜你想搜，热词 -->
		<div>
			<div style="margin-left: 10px;margin-top: 30px;font-size: 15px;color: inherit;">猜你想搜</div>
		</div>
	</div>
</template>

<script>
	export default {
		data(){
			return {
				show : '',
				value : '',
				historyList : []
			}
		},
		created() {
			this.$axios.get('http://api.kudesoft.cn/news/list',{
				params:{
					kw : ''
				}
			}).then(res => {
				console.log(res.data.result)
			})
		},
		methods:{
			Onserch(){
				if(this.value.trim() == ''){
					return
				} else{
					this.historyList.push(this.value)
					this.value = ''
				}
			},
			back(){
				this.$router.push({
					path:'about'
				})
			}
		}
	}
</script>

<style scoped>
	
</style>
